#include <SDL.h>
#include "../Graphics/Device.h"
#include "../Input/Keyboard.h"
#include "../Input/Mouse.h"
#include "Timer.h"


bool Startup(int argc, char* argv[]);
void Shutdown();
bool Update(double dt);
void Render();


int main(int argc, char* argv[])
{
    if (!Startup(argc, argv))
        return 1;

    Timer timer;
    double elapsed = 1 / 60.0f;

    bool isDone = false;
    while (!isDone)
    {
        SDL_Event e;
        while (SDL_PollEvent(&e))
        {
            switch (e.type)
            {
            case SDL_QUIT:
                isDone = true;
                break;
            }
        }
        Keyboard::Update();
        Mouse::Update();

        timer.GetElapsedTime(elapsed);
        timer.Reset();
        isDone = Update(elapsed);
        Render();
    }

    Shutdown();
    DestroyDevice();
    SDL_Quit();

    return 0;
}
